5、Robot state estimation

imu_calib:https://github.com/dpkoch/imu_calib

imu_filter_madgwick:https://wiki.ros.org/imu_filter_madgwick

robot_localization :http://docs.ros.org/en/melodic/api/robot_localization/html/index.html

5.1、Usage

When using bringup.launch to start, pay attention to modify the parameter [robot_model] to the corresponding camera model, for example, the default is Astra camera;

If it is a high frame rate camera, change it to [default="camera"], and there is no need to add parameters when you start it next time.

image-20210907115939993image-20210907120503728

image-20210906151155539

image-20210906214132860

5.2、Main node

5.2.1、transbot_node

TopicTypeParsing
/transbot/imusensor_msgs/ImuThe most primitive imu data of the car
/transbot/get_velgeometry_msgs/TwistThe most original odometer information of the car

5.2.2、apply_calib

The IMU in Yahboom's image system has been calibrated. If you are using a Yahboom image file, no calibration is required.

This course is for reference.

1)Topic
/Topic nameTypeParsing
Subscribed/raw_imusensor_msgs/ImuOriginal, uncalibrated IMU measurement
Published/imu/data_rawsensor_msgs/ImuCorrected, calibrated IMU measurement value
2)Parameter
Parameter nameTypeDefaults valueParsing
~calib_filestring"imu_calib.yaml"Read calibration parameter file
~calibrate_gyrosbooltrueWhether to calculate the deviation of the gyro and subtract the deviation when starting
~gyro_calib_samplesint100Number of measurements used to calculate gyro deviation

5.2.3、imu_filter_madgwick

1)Intrudction

IMU refers to a six-axis sensor, including gyroscope and accelerometer.

MARG refers to a nine-axis sensor, and a magnetometer is added to the IMU.

2)Topic
/Topic nameTypeParsing
Subscribed/imu/data_rawsensor_msgs/ImuMessage of the calibrated IMU data, including angular velocity and linear acceleration
Subscribed/imu/magsensor_msgs/MagneticField[Optional] Magnetometer, will be affected by magnetic field
Published/imu/datasensor_msgs/ImuFusion of Imu information.
3)Parameter
Parameter nameTypeDefaultsParsing
~gaindouble0.1The gain of the filter.
The higher the value, the faster the convergence speed, but the greater the noise.
The lower the value, the slower the convergence speed, but the smoother the signal. Range: 0.0 to 1.0
~zetadouble0.0Gyro drift gain (about rad/s). Range: -1.0 to 1.0
~mag_bias_xdouble0.0Magnetometer bias (hard iron correction), x component. Range: -10.0 to 10.0
~mag_bias_ydouble0.0Magnetometer bias (hard iron correction), y component. Range: -10.0 to 10.0
~mag_bias_zdouble0.0Magnetometer bias (hard iron correction), z component. Range: -10.0 to 10.0
~orientation_stddevdouble0.0The standard deviation of the direction estimate. Range: 0.0 to 1.0
~world_framestring"nwu"The world frame that indicates the direction.
The old default value is "nwu" (northwest up).
New deployments should use "enu". Valid values: "nwu", "enu", "ned".
~use_magbooltrueWhether to use magnetic field data in data fusion.
~use_magnetic_field_msgboolfalseIf set to true,
subscribe to /imu and /mag topics as sensor_msgs/MagneticField;
if set to false (it not recommended),
use geometry_msgs/Vector3Stamped
~fixed_framestringodomThe parent coordinate system to be used in publishing
~publish_tfboolfalseWhether to publish the TF transformation indicating the direction of the IMU, as the pose of the IMU;
Use the fixed coordinate system as the parent coordinate system, and
input the imu information as the child coordinate system
~reverse_tfboolfalseIf set to true, the transformation from the imu coordinate system to the fixed coordinate system will be issued.
~constant_dtdouble0.0The dt to be used; if it is 0.0 (default value), the dynamic value of dt is calculated from the start of the message.
~publish_debug_topicsboolfalseIf set to true, two debugging topics are posted.
~statelessboolfalseIf set to true, the filtered direction will not be published.
Instead, stateless estimates of bearing are issued based only on the latest accelerometer (and optionally magnetometer) readings. Used for debugging.
~remove_gravity_vectorboolfalseIf set to true, the gravity vector is subtracted from the acceleration field in the published IMU message.

5.2.4、robot_localization

1)Introduction

robot_localization is a collection of state estimation nodes. Each node is an implementation of a nonlinear state estimator for robots moving in 3D space. It includes two state estimation nodes ekf_localization_node and ukf_localization_node. In addition, robot_localization provides navsat_transform_node, which helps to integrate GPS data.

ekf_localization_node is an implementation of Extended Kalman Filter. It uses an omni-directional motion model to predict the state in time, and uses the sensor data to correct the estimated value of the prediction.

ukf_localization_node is an implementation of Unscented Kalman Filter. It uses a set of carefully selected sigma points to project the state through the same motion model used in EKF, and then uses these projected sigma points to recover the state estimation and covariance. This eliminates the use of the Jacobian matrix and makes the filter more stable. However, compared with ekf_localization_node, it is also more computationally cumbersome.

topic

/TopicTypeParsing
Subscribed/imu/datasensor_msgs/ImuFiltered imu information
Subscribed/odom_rawnav_msgs/OdometryOdometer information
Published/odomnav_msgs/OdometryConverged odometer information
Published/tftf2_msgs/TFMessageCoordinate system information
2)Parameter
3)Transformation of release

If the user's world_frame parameter is set to the value of odom_frame, the conversion will be published from the coordinate system given by the odom_frame parameter to the coordinate system given by the base_link_frame parameter. If the user's world_frame parameter is set to the value of map_frame, the conversion will be published from the coordinate system given by the map_frame parameter to the coordinate system given by the odom_frame parameter.

For example, we set to publish the conversion from the coordinate system given by the [odom_frame] parameter to the coordinate system given by the [base_link_frame] parameter.

image-20210916180820494

5.3、Precautions

While starting the robot, the robot is stationary. If the buzzer keeps ringing, there are two possibilities:

Solution: